#ifndef __BUOLA_GUI_X11_CX11WINDOWWM_H__
#define __BUOLA_GUI_X11_CX11WINDOWWM_H__

#include <buola/gui/x11/auto.h>
#include <buola/gui/cwindow.h>
#include <buola/gui/x11/cx11sync.h>

namespace buola { namespace gui { namespace x11 {

//////////////////////////////////////////////////////////////////
///////////////////////////                   ////////////////////
//////////////////////////    CX11WindowWM     //////////////////////
///////////////////////////                 //////////////////////
//////////////////////////////////////////////////////////////////

class CX11WindowWM
{
public:
    CX11WindowWM(CX11Window*);
    virtual ~CX11WindowWM();

    void Iconify(bool);
    void Maximize(EWindowState);
    void Shade(bool);
    void Sticky(bool);
    void SetDesktop(int);
    void FullScreen(bool);
    void Activate();
    void StartMoveOperation(CMouseEvent*);
    void StartResizeOperation(CMouseEvent*,EDragState pType);
    void SetTitle(const std::wstring&);
    void SetIcon(PIcon );
    void SetStrut(const CRect_d &pRect);
    void SetOpacity(double pOpacity);
    void InternalMove(const CPoint_d&);
    void InternalResize(const CSize_d&);
    void InternalMoveResize(const CPoint_d&,const CSize_d&);
    void SyncRequested(int64_t pValue);
    void SyncFinished();

    void UpdateInfo();

//functions to communicate with WM as a client
    void ICCCMSetHints();
    void ICCCMSetSizeHints();
    void NETSetState();

    void SendRootMessage(TID,int=0,int=0,int=0,int=0,int=0);

    static bool ShouldDecorate(CWindow *pWindow);
    static bool ShouldSkipTaskbar(CWindow *pWindow);
    static bool ShouldSkipPager(CWindow *pWindow);
    
    CX11SyncCounter mSyncCounter;
    CX11Window *mWindow;
    CX11Display *mDisplay;
    
    EWindowState mState;

    bool mMapped;

    bool mSizeValid;
    bool mPosValid;

    CSize_d mBaseSize;
    CSize_d mResizeInc;

    int mDesktop;

    PIcon mIcon;

    int64_t mSyncRequest;
};

/*namespace x11*/ } /*namespace gui*/ } /*namespace buola*/ }

#endif
